package io.renren.modules.echarts.ResVo;


import io.renren.modules.echarts.entity.BarEntity;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
public class BarVo {
    private String category;
    private int value;

    public static BarVo build(BarEntity entity){
        BarVo barVo = new BarVo();
        barVo.setCategory(entity.getCategory());
        barVo.setValue(entity.getValue());
        return barVo;
    }

    public static List<BarVo> build(List<BarEntity> entities){
        return entities.stream().map(BarVo::build).collect(Collectors.toList());
    }
}
